home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1995…tember: Reference Library / Dev.CD Sep 95 RL / Dev.CD Sep 95 RL.toast / mac / Technical Documentation / develop / develop Issue 6 code / TCP / NewsWatcher / NW Source / Shared Code / Reusable Source / nntp.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-02-25  |  2.9 KB  |  70 lines  |  [TEXT/MMCC]

  1. #ifndef __NTTP__
  2. #define __NNTP__
  3.  
  4. #include "net.h"
  5.  
  6. #define nntpServerErr             130
  7. #define nntpNoSuchGroupErr        131
  8. #define nntpNoSuchArticleErr    132
  9. #define nntpAuthFailedErr        133
  10.  
  11. typedef void *NntpStreamRef;
  12. typedef OSErr (*NntpGiveTimeFunction) (void);
  13.  
  14. typedef struct NntpStreamOptions {
  15.     short idleTime;            /* stream is automatically closed if idle for this 
  16.                                many minutes, or 0 to disable */
  17.     Boolean useXPAT;        /* true to use XPAT command for searches */
  18.     Boolean sendModeReader;    /* true to send MODE READER command after connect */
  19.     Boolean batchedCmds;    /* true to use batched GROUP commands */
  20.     Boolean newConnection;    /* true to establish new connection before getting
  21.                                group info */
  22.     Boolean authOnConnect;    /* true to authorize on each new connection */
  23.     char username[32];        /* authorization username */
  24.     char password[32];        /* authorization password */
  25. } NntpStreamOptions;
  26.  
  27. typedef struct NntpGroupInfo {
  28.     long offset;            /* offset into strings of group name */
  29.     long first;                /* first article number in group */
  30.     long last;                /* last article number in group */
  31.     long count;                /* estimate of number of articles in group */
  32.     char status;            /* group status, lower case */
  33.     Boolean ok;                /* true if no error when getting group info */
  34. } NntpGroupInfo, *NntpGroupInfoPtr, **NntpGroupInfoHandle;
  35.  
  36. typedef struct NntpHeaderInfo {
  37.     long number;            /* article number */
  38.     long offset;            /* offset into strings of header contents */
  39. } NntpHeaderInfo, *NntpHeaderInfoPtr, **NntpHeaderInfoHandle;
  40.  
  41. void NntpInit (NntpGiveTimeFunction giveTime);
  42. OSErr NntpIdle (void);
  43.  
  44. OSErr NntpOpen (char *host, NntpStreamOptions *options, NntpStreamRef *stream);
  45. OSErr NntpClose (NntpStreamRef stream);
  46. OSErr NntpAbort (NntpStreamRef stream);
  47. OSErr NntpSetStreamOptions (NntpStreamRef stream, NntpStreamOptions *options);
  48. OSErr NntpGetGroupNames (NntpStreamRef stream, unsigned long time,
  49.     char *statusFilter, Handle *strings, long *numGroups);
  50. OSErr NntpGetGroupInfo (NntpStreamRef stream, char *group, 
  51.     long *first, long *last, long *count);
  52. OSErr NntpGetMultipleGroupInfo (NntpStreamRef stream, NntpGroupInfoHandle info,
  53.     long numGroups, Handle strings);
  54. OSErr NntpGetHeaders (NntpStreamRef stream, char *group, long first, long last,
  55.     char *header, char *pattern,
  56.     void (*buildXPAT)(char *pattern, char *regExp, short regExpLen),
  57.     Boolean (*matchPattern)(char *pattern, char *string),
  58.     NntpHeaderInfoHandle *info, Handle *strings, long *numHeaders);
  59. OSErr NntpGetArticle (NntpStreamRef stream, char *group, long number, 
  60.     char *id, char *part, Handle *text, NetChunkFunction chunkFunction,
  61.     Ptr userDataPtr);
  62. OSErr NntpPostArticle (NntpStreamRef stream, Handle text, Boolean *postIndeterminate);
  63. OSErr NntpAuthorize (NntpStreamRef stream);
  64. OSErr NntpGetHello (NntpStreamRef stream, CStr255 msg);
  65. OSErr NntpGetHelp (NntpStreamRef stream, Handle *text);
  66. OSErr NntpGetIPAddr (NntpStreamRef stream, unsigned long *ipAddr);
  67. void NntpGetServerErrInfo (NntpStreamRef stream, NetServerErrInfo *serverErrInfo); 
  68.  
  69. #endif
  70.